package com.zyx.edustatistics.controller;


import com.zyx.commonutils.R;
import com.zyx.edustatistics.service.StatisticsDailyService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author zyx
 * @since 2022-01-11
 */
@RestController
@RequestMapping("/staservice/sta")
@CrossOrigin
public class StatisticsDailyController {

    @Resource
    private StatisticsDailyService staService;

    @PostMapping("registerCount/{day}")
    public R registerCount(@PathVariable String day) {

        staService.registerCount(day);
        return R.ok();
    }

    /**
     * 图表显示
     */
    @GetMapping("showData/{type}/{begin}/{end}")
    public R showData( @PathVariable String type,
                       @PathVariable String begin,
                       @PathVariable String end) {

        Map<String,Object> map = staService.getShowData(type,begin,end);


        return R.ok().data(map);
    }

}

